Added keybinding for renaming group with F2#12159
Added keybinding for renaming group with F2#12159Rydzard wants to merge 16 commits intoJabRef:mainfrom
Conversation
|
Hello. I added the Rename Group to the context menu with keybinding (for now I set it to the letter R, because I couldn't try F2 locally, I will change it to F2 in the finale). I just have one problem, that when I change the name of the group, the groups become smaller (I will also send a video example). Can you advise me why it does this and how I could fix it? Video : https://github.com/user-attachments/assets/396d439e-ca00-451c-991b-43f12666bc72 |
There was a problem hiding this comment.
Your code currently does not meet JabRef's code guidelines.
We use Checkstyle to identify issues.
Please carefully follow the setup guide for the codestyle.
Afterwards, please run checkstyle locally and fix the issues.
|
Code wise looks okay to me so far, but I haven't an idea why the group size changes. Does this happen with the normal dialog as well? |
There was a problem hiding this comment.
Your code currently does not meet JabRef's code guidelines.
We use Checkstyle to identify issues.
Please carefully follow the setup guide for the codestyle.
Afterwards, please run checkstyle locally and fix the issues.
There was a problem hiding this comment.
JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.
You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.
| /** | ||
| * Opens "Rename Group Dialog" and change name of group | ||
| */ | ||
|
|
| public void renameGroup(GroupNodeViewModel oldGroup) { | ||
| currentDatabase.ifPresent(database -> { | ||
| AbstractGroup oldGroupDef = oldGroup.getGroupNode().getGroup(); | ||
| String oldGroupName = oldGroupDef.getName(); // Zachytenie starého názvu pred otvorením dialógu |
There was a problem hiding this comment.
Please translate the comment (or remove it)
| return; | ||
| } | ||
|
|
||
| // check if is not include "," |
There was a problem hiding this comment.
Remove comment - the next line says the same.
The WHY is important. Why is this check done.
There was a problem hiding this comment.
Hello. I removed this comment. I check this because I inspired by Edit group where this check too. I can remove this if-statement if you want.
| return; | ||
| } | ||
|
|
||
| // chceck if old group name dont equels with new group name |
There was a problem hiding this comment.
Remove comment - next line says it
| nameField = new TextField(); | ||
| nameField.setPromptText("Enter new group name"); | ||
|
|
||
| // add Input |
| getDialogPane().getButtonTypes().setAll(ButtonType.OK, ButtonType.CANCEL); | ||
|
|
||
| nameField = new TextField(); | ||
| nameField.setPromptText("Enter new group name"); |
There was a problem hiding this comment.
Use Localiaztion.lang - see https://devdocs.jabref.org/code-howtos/localization.html
| nameField.setPromptText("Enter new group name"); | ||
|
|
||
| // add Input | ||
| VBox vbox = new VBox(new Label("New group name:"), nameField); |
There was a problem hiding this comment.
Use Localiaztion.lang - see https://devdocs.jabref.org/code-howtos/localization.html
No ":"
| VBox vbox = new VBox(new Label("New group name:"), nameField); | ||
| getDialogPane().setContent(vbox); | ||
|
|
||
| // If press OK change name else return null |
| if (buttonType == ButtonType.OK) { | ||
| return resultConverter(ButtonType.OK).orElse(null); | ||
| } else { | ||
| // Ak sa zvolí Cancel alebo sa dialóg zavrie cez X |
There was a problem hiding this comment.
JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.
You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.
|
Hello @koppor @Siedlerchr . I have a small problem with Unit Test findMissingLocalizationKeys(). I added strings to JabRef_en.properties, but this test on my local computer still shows error that I dont have string in this file. Can someone tell, what I have done wrong please? |
There was a problem hiding this comment.
JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.
You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.
|
That looks correct at first sight . Maybe some caching. Can you push the modifications? Then we can see if it works on CI |
There was a problem hiding this comment.
JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.
You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.
There was a problem hiding this comment.
JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.
You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.
There was a problem hiding this comment.
JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.
You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.
| if (newGroupName.contains(",")) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Doesn't JabRef have a check for new group names?
What about the dialog to add new groups?
If the check is also in there, maybe, the method can be extracted?
| if (oldGroupName.equals(newGroupName)) { | ||
| return; | ||
| } |
| ); | ||
|
|
||
| newGroup.ifPresent(group -> { | ||
|
|
There was a problem hiding this comment.
Pleaase - not that many empty lines. Especially not after {.
| int groupsWithSameName = 0; | ||
| Optional<GroupTreeNode> databaseRootGroup = currentDatabase.get().getMetaData().getGroups(); | ||
| if (databaseRootGroup.isPresent()) { | ||
| groupsWithSameName = databaseRootGroup.get().findChildrenSatisfying(g -> g.getName().equals(newGroupName)).size(); |
There was a problem hiding this comment.
There needs to be comment why this is necessary. At first guess, I would have thought that there must not be any other group with the same name. Why is one other group with the same name OK?
There was a problem hiding this comment.
Still valid comment. I don't see any comment in the Java code. Thus, I cannot judge - and future code readers should have a clue, too!
There was a problem hiding this comment.
JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.
You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.
koppor
left a comment
There was a problem hiding this comment.
- F2 does not work here. (windows 10)
- Dialog does not show current group name
- Dialog does not focus text field for new group name
It is not clear which issue is addressed.
Best is to trigger "Edit group dialog" on press of F2.
Alternatively, an in-line editing at the groups tree can be done. Similar to "file rename" in VS.Code.
This PR does not do any of these two, therefore, I close this PR.
Feel free to re-open if you intend to work on these issues.
| @Nullable GroupTreeNode parentNode, | ||
| @Nullable AbstractGroup editedGroup, | ||
| GroupDialogHeader groupDialogHeader) { | ||
|
|
| private final EnumMap<GroupHierarchyType, String> hierarchyToolTip = new EnumMap<>(GroupHierarchyType.class); | ||
|
|
||
| private final ControlsFxVisualizer validationVisualizer = new ControlsFxVisualizer(); | ||
|
|
There was a problem hiding this comment.
This removal of the empty line is OK.
| int groupsWithSameName = 0; | ||
| Optional<GroupTreeNode> databaseRootGroup = currentDatabase.get().getMetaData().getGroups(); | ||
| if (databaseRootGroup.isPresent()) { | ||
| groupsWithSameName = databaseRootGroup.get().findChildrenSatisfying(g -> g.getName().equals(newGroupName)).size(); |
There was a problem hiding this comment.
Still valid comment. I don't see any comment in the Java code. Thus, I cannot judge - and future code readers should have a clue, too!



Describe the changes you have made here: what, why, ...
Link the issue that will be closed, e.g., "Closes #333". If your PR closes a koppor issue, link it using its URL, e.g., "Closes JabRef#47".
Mandatory checks
CHANGELOG.mddescribed in a way that is understandable for the average user (if change is visible to the user)